package steed.sample.dubbo;

import java.io.IOException;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.RegistryConfig;

import steed.test.SteedTest;

public class QuickStart extends SteedTest {

	@Test
	public void startProvider() {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "dubbo-provider.xml" });
		context.start();
		try {
			System.in.read();
		} catch (IOException e) {
			e.printStackTrace();
		}

		ApplicationConfig applicationConfig = new ApplicationConfig();
		applicationConfig.setName(""); 
//		applicationConfig.set
		
		RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress(""); 
		
//		ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
//		reference.setApplication(application);
//		reference.setRegistry(registry);
//		reference.setInterface(interfaceClass); 
//		reference.setv

	}

	@Test
	public void startConsumer() {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "dubbo-consumer.xml" });
		DemoService demoService = (DemoService) context.getBean("demoService"); // obtain proxy object for remote
																				// invocation
		String hello = demoService.sayHello("world54"); // execute remote invocation
		System.out.println(hello); // show the result
	}
}
